<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	<link rel="stylesheet" href="lib/bootstrap-3.3.7.css">
	<script type="text/javascript" src="lib/vue-2.4.0.js"></script>
	<script type="text/javascript" src="lib/vue-router.min.js"></script>
	<style>
	.router-link-active,.myactive {
		color:  red;
		font-size:  24px;
	}
	.v-enter,
    .v-leave-to {
      opacity: 0;
      transform: translateX(140px);
    }

    .v-enter-active,
    .v-leave-active {
      transition: all 0.5s ease;
    }
	</style>
</head>
<body>
	<div id="app">
		<!-- <a href="#/login">登录</a>
		<a href="#/reg">注册</a> -->
		<router-link to="/login" tag="span">登录</router-link>
		<router-link to="/reg" tag="span">注册</router-link>

		<transition mode="out-in">
			<router-view></router-view>
		</transition>
	</div>
	<script>

	// 登录模版
	var temLogin = {
		template: '<h1>登录模版</h1>'
	}
	// 注册模版
	var temReg = {
		template: '<h1>注册模版</h1>'
	}
	// 创建路由
	var routerObj = new VueRouter({
		routes: [ // 路由匹配规则
			{ path: '/', redirect: '/login' }, // 指定默认打开的路由
			{ path: '/login' , component: temLogin },
			{ path: '/reg' , component: temReg }
		],
		// 配置自己的激活类
		linkActiveClass: 'myactive'
	});
	var vm = new Vue({
		el: '#app',
		data: {},
		methods: {

		},
		components: {

		},
		router: routerObj
	});
	</script>
</body>
</html>